Contents | Index | < Browse | Browse >
LETTERistreamULETTER
A stream class for input operations.
Overview
#include <iostream.h>
class istream : virtual public ios {
public:
istream(streambuf *b);
virtual ~istream();
public:
int ipfx(int need = 0);
void isfx();
istream &operator >>(unsigned char *s);
istream &operator >>(signed char *s);
istream &operator >>(char *);
istream &operator >>(char &);
istream &operator >>(unsigned char &c);
istream &operator >>(signed char &c);
istream &operator >>(short &);
istream &operator >>(unsigned short &);
istream &operator >>(int &);
istream &operator >>(unsigned int &);
istream &operator >>(long &);
istream &operator >>(unsigned long &);
istream &operator >>(float &);
istream &operator >>(double &);
istream &operator >>(long double &);
istream &operator >>(streambuf *);
istream &operator >>(istream &(*f)(istream &));
istream &operator >>(ios &(*f)(ios &));
istream &get(char *, int, char = '\n');
istream &get(unsigned char *s, int n, char delimiter = '\n');
istream &get(signed char *s, int n, char delimiter = '\n');
istream &getline(char *, int, char = '\n');
istream &getline(unsigned char *s, int n, char delimiter = '\n');
istream &getline(signed char *s, int n, char delimiter = '\n');
istream &get(streambuf &, char = '\n');
istream &get(signed char &c);
istream &get(unsigned char &c);
istream &get(char &);
int get();
istream &ignore(int = 1, int = EOF);
istream &read(unsigned char *s, int n);
istream &read(signed char *s, int n);
istream &read(char *, int);
int gcount();
int peek();
istream &putback(char c);
int sync();
istream &seekg(streampos);
istream &seekg(streamoff, ios::seek_dir);
streampos tellg();
protected:
istream();
};
Portability
AT&T Release 2 streams library
Description
The istream class is the base class for formatted and unformatted stream
input.
Constructors
istream::istream(streambuf *b);
Initializes the input stream and binds the buffer.
Methods
int istream::ipfx(int need = 0);
This input prefix function performs all actions required for formatted
input and returns EOF if an error occured (which may also have already
occured before calling this method). If need is 0, or there are less than
need characters in the buffer the associated output stream is flushed (see
ios::tie()). If need is 0 and the ios::skipws formatting flag is set all
whitespaces will be skipped.
void istream::isfx();
Input suffix function. Performs all actions required after an input. Currently
unused.
istream &istream::operator >>(unsigned char *s);
istream &istream::operator >>(signed char *s);
istream &istream::operator >>(char *);
Extracts a string until a whitespace character is encountered. The maximum
number of characters to be read can be set using the field width: if
ios::width() != 0 no more than ios::width()-1 chars will be read.
istream &istream::operator >>(char &);
istream &istream::operator >>(unsigned char &c);
istream &istream::operator >>(signed char &c);
Extracts a single character.
istream &istream::operator >>(short &);
istream &istream::operator >>(unsigned short &);
istream &istream::operator >>(int &);
Extracts a number.
istream &istream::operator >>(unsigned int &);
istream &istream::operator >>(long &);
istream &istream::operator >>(unsigned long &);
Extracts absolute, unsigned numbers.
istream &istream::operator >>(float &);
istream &istream::operator >>(double &);
istream &istream::operator >>(long double &);
Extracts floating-point numbers.
istream &istream::operator >>(istream &(*f)(istream &));
istream &istream::operator >>(ios &(*f)(ios &));
Support for simple manipulators. The function specified will be called
with the istream object as argument.
istream &istream::get(char *, int n, char = '\n');
istream &istream::get(unsigned char *s, int n, char delimiter = '\n');
istream &istream::get(signed char *s, int n, char delimiter = '\n');
Reads up to n-1 characters until the specified delimiter is found which will
be included in the string. The string will be terminated with a zero byte.
istream &istream::getline(char *, int n, char = '\n');
istream &istream::getline(unsigned char *s, int n, char delimiter = '\n');
istream &istream::getline(signed char *s, int n, char delimiter = '\n');
Reads up to n-1 characters until the specified delimiter is found which will
neither be included in the string nor pushed back into the stream. The string
will be terminated with a zero byte.
istream &istream::get(signed char &c);
istream &istream::get(unsigned char &c);
istream &istream::get(char &);
Extracts a single character.
int istream::get();
Returns the next character of EOF.
istream &istream::ignore(int n = 1, int delimiter = EOF);
Skips up to n characters until the specified delimiter is found.
istream &istream::read(unsigned char *s, int n);
istream &istream::read(signed char *s, int n);
istream &istream::read(char *, int);
Unformatted read of n characters into the buffer. If an error occurs (eg. if
there were less than n characters) ios::failbit will be set.
int istream::gcount();
Returns the number of characters returned by the last unformatted read.
Formatted functions can modify this value in unexpected ways.
int istream::peek();
Returns EOF if istream::ipfx(1) returns EOF and the next stream character
otherwise. The character will however be pushed back.
istream &istream::putback(char c);
Pushes the last character read, which must be the same as the character
"c" passed, back into the stream. This does not work EOF. If an error
occurs (eg. if the stream does not allow to push back characters) ios::badbit
is set. The ifstream class allows this.
int istream::sync();
Flushes the tied stream buffer and returns the same result as
streambuf::sync().
istream &istream::seekg(streampos);
Sets the stream's read pointer to the specified position obtained from a
call to istream::tellg().
istream &istream::seekg(streamoff, ios::seek_dir);
Sets the stream's read pointer to the specified offset based on the
relative seek position. See streambuf::seekoff() for details.
streampos istream::tellg();
Returns the current position of the stream's read pointer which must not
necessarily be the stream's physical position (eg. in a file) due to the
usage of the stream buffer.
See also
ios , iostream , ifstream , ostream